package com.donger.mq.controller;

import com.donger.common.core.utils.Res;
import com.donger.common.core.utils.Result;
import com.donger.mq.producer.Sender;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@AllArgsConstructor
@RequestMapping("/mq")
public class MqController {

    private final Sender sender;


    @GetMapping({"/send/{string}", "/send"})
    public Result send(@PathVariable("string") String string) {
        sender.send(string);
        return Res.ok().data(string);
    }

}
